package cn.snowheart.command.inter;

/**
 * 可调速的吊扇
 *
 * @author liuwanxiang
 * @version 2019/07/04
 */
public class CeilingFan {

    /**
     * 不同转速的一个常量枚举值
     */
    public static final int HIGH = 3;
    public static final int MEDIUM = 2;
    public static final int LOW = 1;
    public static final int OFF = 0;

    private String location;
    private int speed;

    public CeilingFan(String location) {
        this.location = location;
        this.speed = OFF;
    }

    public void low() {
        this.speed = LOW;
        print();
    }

    public void medium() {
        this.speed = MEDIUM;
        print();
    }

    public void high() {
        this.speed = HIGH;
        print();
    }

    public void off() {
        this.speed = OFF;
        print();
    }

    public int getSpeed() {
        return speed;
    }

    private void print() {
        System.out.printf("%s ceiling fan speed is %d\n", location, speed);
    }
}
